/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.calculator-container {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

h1 {
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
}

.calculator {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    padding: 20px;
    width: 100%;
}

.display {
    margin-bottom: 15px;
}

#display {
    width: 100%;
    height: 60px;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-align: right;
    padding: 0 15px;
    font-size: 24px;
    background-color: #f9f9f9;
}

.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 10px;
}

.btn {
    height: 50px;
    border: none;
    border-radius: 5px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn:hover {
    opacity: 0.9;
}

.btn:active {
    transform: scale(0.98);
}

.number {
    background-color: #f0f0f0;
    color: #333;
}

.operator {
    background-color: #f0ad4e;
    color: white;
}

.equals {
    background-color: #5cb85c;
    color: white;
    grid-row: span 2;
}

.clear {
    background-color: #d9534f;
    color: white;
}

.backspace {
    background-color: #5bc0de;
    color: white;
}

.zero {
    grid-column: span 2;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .calculator {
        padding: 15px;
    }
    
    .btn {
        height: 45px;
        font-size: 16px;
    }
    
    #display {
        height: 50px;
        font-size: 20px;
    }
}